#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
using namespace std;

class Solution{
public:
    static string removeDuplicates(string s) {
        string ret;
        for (int i = 0; i < s.size(); i++)
        {
            if (ret.size() == 0)
            {
                ret += s[i];
            }
            else
            {
                if (ret[ret.size() - 1] == s[i])
                {
                    ret.pop_back();
                }
                else
                {
                    ret += s[i];
                }
            }

        }
        cout << ret << endl;
        return ret;
    }
};
int main()
{
    Solution::removeDuplicates("abbaca");
	return 0;
}